<?
class MatchersCaseTest {
	private $m1 = true;
	private $m2 = false;
}
return array(
	'name'=>'Matchers', 
	'desc'=>'Its testing matchers from Test Module',
	'each'=> array(
		'matcher'=>null
	),
	
	'beforeEach'=>function(&$each) {
		$each['matcher'] = new WID\Test\Matchers();
	},
	
	'tests'=>array(
		'creating'=>function(&$each) {
			$spy = $this->need->PropertiesSpy->onObject($each['matcher']);
			$this->expect($spy->valueOf('MatchLog'))->toBe('');
			$this->expect($spy->valueOf('Target'))->toBeNull();
			$this->expect($spy->valueOf('Negation'))->toBeFalse();
		},
		
		/*'toPrimitive'=>function(&$each) {
			$m = $each['matcher'];
			
			$testData = array('v1'=>'test','v2'=>false);
			$primitive = serialize($testData);
			$this->expect($m->toPrimitive($testData))->toBe($primitive);
			
			$testData = new MatchersCaseTest();
			$primitive = serialize($testData);
			$this->expect($m->toPrimitive($testData))->toBe($primitive);
		},*/
		
		'newExpect'=>function(&$each) {
			$m = $each['matcher'];
			$spy = $this->need->PropertiesSpy->onObject($m);
			$m->newExpect(1,2);
			$this->expect($spy->valueOf('Target'))->toBe(2);
			$this->expect($spy->valueOf('CurrentExpect'))->toBe('<b>(1) Expected</b> ');
			$this->expect($spy->valueOf('Negation'))->toBe(false);
		},
		
		'logFailure'=>function(&$each) {
			$spy = $this->need->PropertiesSpy->onObject($each['matcher']);
			$spy->setValueOf('CurrentExpect')->on('T');
			$each['matcher']->logFailure('t');
			$this->expect($spy->valueOf('MatchLog'))->toBe('Tt');
		},
		
		'notProperty'=>function(&$each) {
			$m = $each['matcher'];
			$spy = $this->need->PropertiesSpy->onObject($m);
			$this->expect($m->not)->toBe($m);
			$this->expect($spy->valueOf('Negation'))->toBe(true);
		},
		
		'logProperty'=>function(&$each) {
			$m = $each['matcher'];
			$spy = $this->need->PropertiesSpy->onObject($m);
			$spy->setValueOf('MatchLog')->on('test');
			$this->expect($m->log)->toBe('test');
			$this->expect($spy->valueOf('MatchLog'))->toBe('');
		},
		
		'toBe'=>function() {
			$this->expect(true)->toBe(true);
			$this->expect(true)->not->toBe(false);
		},             
		
		'toBeNull'=>function() {
			$this->expect(null)->toBeNull();
			$this->expect('def')->not->toBeNull();
		},           
		                  
		'toBeDefined'=>function() {
			$this->expect('def')->toBeDefined();
			$this->expect(null)->not->toBeDefined();
		},
		
		'toBeTrue'=>function() {
			$this->expect(true)->toBeTrue();
			$this->expect(1)->toBeTrue();
			$this->expect(false)->not->toBeTrue();
		},
		
		'toBeFalse'=>function() {
			$this->expect(false)->toBeFalse();
			$this->expect('')->toBeFalse();
			$this->expect(true)->not->toBeFalse();
		},
		
		'toBeInstanceOf'=>function() {
			class A {}
			$a = new A;
			$this->expect($a)->toBeInstanceOf('A');
		},
		
		'toBeGreaterThan'=>function() {
			$this->expect(1)->toBeGreaterThan(0);
			$this->expect(0)->not->toBeGreaterThan(1);
		},
		
		'toBeGreaterThanOnObject'=>function() {
			/*
			$this->expect({test:1})->toBeGreaterThan({test:0},function(v1,v2){
				return (v1.test > v2.test);
			});
			$this->expect({test:0})->not.toBeGreaterThan({test:1},function(v1,v2){
				return (v1.test > v2.test);
			});
			 */
		},
		
		'toBeLessThan'=>function() {
			$this->expect(0)->toBeLessThan(1);
			$this->expect(1)->not->toBeLessThan(0);
		},
		
		'toBeLessThanOnObject'=>function() {
			/*
			$this->expect({test:0})->toBeLessThan({test:1},function(v1,v2){
				return (v1.test < v2.test);
			});
			
			$this->expect({test:1})->not.toBeLessThan({test:0},function(v1,v2){
				return (v1.test < v2.test);
			});
			*/
		},
		
		'toBeEqual'=>function() {
			$this->expect(1)->toBeEqual(1);
			$this->expect(0)->not->toBeEqual(1);
		},
		
		'toBeEqualOnObject'=>function() {
			/*$this->expect({test:1})->toBeEqual({test:1}, function(v1,v2){
				return v1.test === v2.test;
			});
			$this->expect({test:1})->not.toBeEqual({test:0}, function(v1,v2){
				return v1.test === v2.test;
			});*/
		},
		
		'toThrow'=>function() {
			$this->expect(function() {
				throw new Exception('test');
			})->toThrow('Exception')->withMessage('test');
			
			$this->expect(function() {
			})->not->toThrow('Exception');
		}
	)
);
?>